package model;

import model.type.EmployeeRoleType;
import db.ImbiConnection;

public class EmployeeRole {
	private final int id;
	private int employee;
	private int employeeRoleType;
	private boolean active;
	
	public EmployeeRole(int id, int employee, int employeeRoleType,
			boolean active) {
		super();
		this.id = id;
		this.employee = employee;
		this.employeeRoleType = employeeRoleType;
		this.active = active;
	}

	public int getEmployee() {
		return employee;
	}

	public void setEmployee(int employee) {
		this.employee = employee;
	}

	public int getEmployeeRoleType() {
		return employeeRoleType;
	}

	public void setEmployeeRoleType(int employeeRoleType) {
		this.employeeRoleType = employeeRoleType;
	}

	public boolean isActive() {
		return active;
	}

	public void setActive(boolean active) {
		this.active = active;
	}

	public int getId() {
		return id;
	}
	
	/*OBJECT ACCESS METHODS*/
	
	public String getRoleTypeString(){
		return EmployeeRoleType.getEmployeeRoleType(getEmployeeRoleType()).getType();
	}
	
	public Employee getEmployeeObject(){
		return getEmployeeById(getEmployee());
	}
	
	private Employee getEmployeeById(int id){
		return ImbiConnection.getEmployeeDAO().find(id);
	}
		
}
